#ifndef MAINUI_H
#define MAINUI_H

#include <QWidget>
#include <QTcpSocket>
#include <QHostAddress>
#include <QMessageBox>
#include "test.h"   //测试界面包含各种加密函数
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
#include <rsa.h>
#include <aes.h>
#include <diffie_hellman.h>
namespace Ui {
class mainui;
}
class mainui : public QWidget
{
    Q_OBJECT

public:
    explicit mainui(QWidget *parent = 0);
    ~mainui();
    QSqlDatabase database;
    void createdatabase();
    QTcpSocket *tcpClient;  //tcp客户端的类
    rsa rsa_a;//用于加密，验证
    rsa rsa_b;//用于解密，签名
    QStringList usernamelist;//用户名列表
    int flag;
    QByteArray intTo4ByteArray(int i);//整数数组转化为QByteArray
    int ByteArray4ToInt(const QByteArray &bytes);//QByteArray转化为整数数组
    QMetaObject::Connection dis;//管理接收信号的槽函数，退出界面时关闭
    void Initialize();
    unsigned char* getkey(int k);
    diffie_hellman DH;

    int msglenthforweb;//QString长度
    QString getnewString(QString s);//扩充字符串长度
signals:
   void sendsignal_1();
private slots:
    void on_pushButton_clicked();

    void on_sendmsg_clicked();

    void on_connect_clicked();

    void ReadData();

    void Disconnected();

    void on_toolButton_clicked();
    void on_cleartextedit_clicked();

    void on_sendfalsemsg_clicked();
    void qtimeSlot();

private:
    Ui::mainui *ui;
    test *test1;
    QTimer *timer;
};

#endif // MAINUI_H
